"""
课程相关模式
"""
from pydantic import BaseModel
from typing import Optional
from decimal import Decimal
from .base import BaseSchema, TimestampMixin


class CourseBase(BaseModel):
    """课程基础模式"""
    name: str
    subject_id: int
    total_stages: int = 4
    total_price: Decimal
    description: Optional[str] = None


class CourseCreate(CourseBase):
    """创建课程"""
    pass


class CourseUpdate(BaseModel):
    """更新课程"""
    name: Optional[str] = None
    subject_id: Optional[int] = None
    total_stages: Optional[int] = None
    total_price: Optional[Decimal] = None
    description: Optional[str] = None
    status: Optional[str] = None


class CourseResponse(CourseBase, TimestampMixin, BaseSchema):
    """课程响应"""
    id: int
    status: str


class CourseStageBase(BaseModel):
    """课程阶段基础模式"""
    course_id: int
    stage_number: int
    stage_name: str
    stage_price: Decimal
    description: Optional[str] = None


class CourseStageCreate(CourseStageBase):
    """创建课程阶段"""
    pass


class CourseStageResponse(CourseStageBase, BaseSchema):
    """课程阶段响应"""
    id: int
